﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyGeneric
{
    class GenericConstraint
    {
        public static T Get<T>(T t)
            where T : class  //T 必须是个引用类型
        {
            People pp = new People();
           
            return default(T);
        }

        public static T Query<T>(T t)
            where T : struct  //T 必须是个值类型
        {
            return default(T);
        }

        public static void SayHi<T>(T t) where T:People  //T必须是 People或者它的子类
        {
            Console.WriteLine("ID={0} Name={1}", t.Id, t.Name);
            t.SayHi();
        }
    }
}
